<template>
    <div class="ec-app-container">
        <!-- 查询条件 -->
        <div class="filter-container">
            <el-form label-width="90px">
                <el-row :gutter="10">
                    <el-col :span="6">
                        <el-form-item label="用户账号：" >
                            <el-input v-model="listQuery.title" placeholder="视频标题"/>
                        </el-form-item>
                    </el-col><el-col :span="6">
                        <el-form-item label="用户名：" >
                            <el-input v-model="listQuery.title" placeholder="用户名"/>
                        </el-form-item>
                    </el-col><el-col :span="6">
                        <el-form-item label="是否可用：" >
                            <el-input v-model="listQuery.title" placeholder="是否可用"/>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6" class="text-center">
                        <el-button type="primary" class="border-4C7FD7 color-4C7FD7" icon="el-icon-search" @click="searchList">查询</el-button>
                        <el-button class="border-4C7FD7 color-4C7FD7" @click="resetSearch">重置</el-button>
                    </el-col>
                </el-row>
            </el-form>
        </div>
        <!-- table -->
        <div>
            <div class="mt-30">
                <el-button class="filter-item" type="primary" @click="showDialog">新增</el-button>
            </div>
            <div class="mt-20">
                <el-table
                        v-loading="listLoading"
                        :data="list"
                        border
                        fit
                        highlight-current-row
                        @selection-change="handleSelectionChange"
                        style="width: 100%;">
                    <el-table-column
                            type="selection"
                            width="55"/>
                    <el-table-column label="操作" align="center" width="80">
                        <template slot-scope="scope">
                            <el-button type="text" size="mini" @click="updateDialog(scope.row)">编辑</el-button>
                        </template>
                    </el-table-column>
                    <el-table-column prop="" label="用户账号" align="center"></el-table-column>
                    <el-table-column prop="" label="用户名" align="center"></el-table-column>
                    <el-table-column prop="" label="角色" align="center"></el-table-column>
                    <el-table-column prop="" label="创建时间" align="center"></el-table-column>
                    <el-table-column prop="" label="更新时间" align="center"></el-table-column>
                    <el-table-column prop="" label="最后登录时间" align="center"></el-table-column>
                    <el-table-column prop="" label="是否可用" align="center"></el-table-column>
                </el-table>
            </div>
            <pagination v-show="total>0" :total="total" :page.sync="listQuery.pageNum" :limit.sync="listQuery.pageSize" @pagination="searchList" />
        </div>
        <!-- 新增修改 -->
        <el-dialog :visible.sync="dialogFormVisible" title="新增视频" width="450px">
            <el-form ref="objectForm" :model="object" :rules="objectRules" label-width="110px">
                <el-row>
                    <el-form-item label="用户账号：" prop="username">
                        <el-input v-model="object.username"/>
                    </el-form-item>
                    <el-form-item label="密码：" prop="password">
                        <el-input v-model="object.password"/>
                    </el-form-item>
                    <el-form-item label="确认密码：" prop="roleName">
                        <el-input v-model="object.videoDesc"/>
                    </el-form-item>
                    <el-form-item label="角色：" prop="roleName">
                        <el-input v-model="object.videoUrl"/>
                    </el-form-item>
                    <el-form-item label="用户名称：" prop="roleName">
                        <el-input v-model="object.videoUrl"/>
                    </el-form-item>
                    <el-form-item label="邮箱：" prop="roleName">
                        <el-input v-model="object.videoUrl"/>
                    </el-form-item>
                    <el-form-item label="备注：" prop="roleName">
                        <el-input v-model="object.videoUrl"/>
                    </el-form-item>
                    <el-form-item label="账户是否可用：" prop="roleName">
                        <el-input v-model="object.videoUrl"/>
                    </el-form-item>
                </el-row>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="onCancel">取 消</el-button>
                <el-button type="primary" :loading="btnLoading" @click="onSubmit">确 定</el-button>
            </div>
        </el-dialog>
    </div>
</template>

<script>
    import Pagination from '@/components/Pagination' // Secondary package based on el-pagination、
    import { saveNewMedia } from '@/api'
    import mixin from './rules/user.js' // 自定义验证规则
    export default {
        name: 'Project',
        components: {
            Pagination
        },
        mixins: [ mixin ],
        data() {
            return {
                listQuery: {
                    title: '',
                    pageSize: 10,
                    pageNum: 1
                },
                object: {
                    'username': '',
                    'password': '',
                    'videoCover': '',
                    'videoTitle': '',
                    'videoDesc': '',
                    'videoUrl': '',
                    'releaseStatus': 1
                }
            }
        },
        created() {
            this.searchList()
        },
        methods: {
        }
    }
</script>